<?php require_once("../_files/db.php") ?>
<?php
// ob_start();
header('Content-type: application/json');

// header("Content-type:text/json;charset=utf-8");
$json_arr = array();
$sql = "select * from products";
$cateId = $_GET['cate_id'];
$limit = $_GET['limit'];
if($cateId){
    $sql = $sql. " where categori_id='$cateId'";
}
if($limit){
    $sql = $sql. " limit $limit";
}

$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
    array_push($json_arr,$row); 
}
// $json_arr = array("username"=>$row);
$json_obj = json_encode($json_arr);
echo $json_obj;
?>